package com.ruoyi.common.config;

import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.concurrent.TimeUnit;

/**
 * @Classname WebConfig
 * @Description TODO
 * @Date 2025/3/24 15:10
 * @Created by xxx
 */
@Configuration
@RequiredArgsConstructor
class WebConfig implements WebMvcConfigurer {
    private final FileStorageProperties fileStorageProperties;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String path = fileStorageProperties.getUploadDir()+"/";
//        registry.addResourceHandler("/files/**")
//                .addResourceLocations("file:" + path)
//                .setCacheControl(CacheControl.maxAge(1, TimeUnit.HOURS).cachePublic());
    }
}
